class Test10 {
    public void func() {
        int a = 10;
        if (10 == a) {
            throw new NullPointerException("空指针");
        }
    }

    // 编译异常必须在方法中注明会抛出异常
    public void func1() {
        try {
            int a = 10;
            if (a == 11) {
                throw new CloneNotSupportedException("hello");
            } else {
                throw new NullPointerException("空指针");
            }
        }catch (CloneNotSupportedException e) {
            System.out.println("异常 " + e.getMessage());
        } finally {
            System.out.println("你异常了");
        }
    }
}


public class Class10_Exception {
    public static void main(String[] args) throws CloneNotSupportedException {
        Test10 t = new Test10();
        t.func1();
    }
}
